package com.zhanghu.hibernate.entity;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * @Author: zhanghu
 * @Description:
 * @Date: Create in 16:31 2020/1/8
 * @modified by:
 */
@Entity
@Table(name = "z_user", schema = "mytest", catalog = "")
public class ZUser {
    private Integer id;
    private String name;
    private String password;
    private String email;
    private Timestamp time;
    private String number;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name", nullable = true, length = 50)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "password", nullable = false, length = 255)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "email", nullable = true, length = 30)
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Basic
    @Column(name = "time", nullable = false)
    public Timestamp getTime() {
        return time;
    }

    public void setTime(Timestamp time) {
        this.time = time;
    }

    @Basic
    @Column(name = "number", nullable = true, length = 255)
    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ZUser zUser = (ZUser) o;
        return Objects.equals(id, zUser.id) &&
                Objects.equals(name, zUser.name) &&
                Objects.equals(password, zUser.password) &&
                Objects.equals(email, zUser.email) &&
                Objects.equals(time, zUser.time) &&
                Objects.equals(number, zUser.number);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, name, password, email, time, number);
    }
}
